/***********************************************************
 
 File name: UITextField+Placeholder.m
 Author:    xuwei
 Description:
 UITextField的Placeholder扩展
 
 History:
 2018/02/27: Created
 
 ************************************************************/

#import "UITextField+Placeholder.h"

@implementation UITextField (Placeholder)

/**
 设置TextField的placeholder的字体颜色、字号

 @param holderText placeholder
 @param pTextColor placeholder的字体颜色
 @param pFont placeholder的字号
 */
-(void)textFieldWithHolderText:(NSString *)holderText
          placeholderTextColor:(UIColor *)pTextColor
               placeholderFont:(UIFont *)pFont {
    NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:holderText];
    [placeholder addAttribute:NSForegroundColorAttributeName
                        value:pTextColor
                        range:NSMakeRange(0, holderText.length)];
    [placeholder addAttribute:NSFontAttributeName
                        value:pFont
                        range:NSMakeRange(0, holderText.length)];
    self.attributedPlaceholder = placeholder;
    
}

@end
